<template>
  <div class="container">
    <Nav style="z-index:999"></Nav>
    <div class="menuMain">
      <div class="recipe_header">
        <div class="recipe_header_c">
          <div class="recipe_topimgw">
            <img class="recipe_topimg" :src="main_image" />
          </div>
          <div class="recipe_header_info">
            <h1 class="recipe_title">{{ dish.name }}</h1>
            <span class="info1"> 19 收藏 · 13343 浏览</span>
            <div class="info2">
              <!-- <div class="info2_item info2_item1">
                <em>工艺</em> <strong>{{ menu.make_way }}</strong>
              </div> -->
            </div>
            <div class="recipe_ingredientsw">
              <div class="recipe_ingredients">
                <div class="left"><strong>一般价</strong></div>
                <div class="right">
                  <strong>{{ generPrices }}</strong>
                </div>
              </div>
              <div class="recipe_ingredients recipe_ingredients1">
                <div class="left"><strong>最低价</strong></div>
                <div class="right">
                  <strong>{{ lowerPrices }}</strong>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="menuStep">
      <h2 class="menuStepTitle">这些师傅会做这道菜...</h2>
      <el-row>
        <el-col :span="6" v-for="(item, index) in masterList" :key="index"
          ><li>
            <a href="javascrip:;">
              <i
                ><img
                  src="https://i3.meishichina.com/attachment/recipe/2021/11/25/2021112516378127319541958079.jpg?x-oss-process=style/c320"
                  alt=""
              /></i>
              <p>{{ item.name }}</p>
              <!-- <p>评分：{{ item.score }}</p> -->

              <p>
                <el-button v-on:click="goBookingMaster(item)" type="primary"
                  >去预约师傅</el-button
                >
              </p>
            </a>
          </li></el-col
        >
      </el-row>
    </div>
  </div>
</template>

<script>
import Nav from "@/components/nav";
import { get_master_by_dishId } from "../../api/mdy/index";

export default {
  components: {
    Nav
  },
  data() {
    return {
      dish: {}, //接收路由传参的菜
      generPrices: 0, //一般价
      lowerPrices: 0, //最低价
      masterList: [], //会该道菜的师傅列表
      main_image:
        "https://st-cn.meishij.net/r/212/181/5295462/s5295462_148413003855190.jpg" //主图
    };
  },
  watch: {},
  mounted() {
    // this.getMenu();
    this.dish = this.$route.query.dish;
    this.getMasterListByDishId();
  },
  methods: {
    goBookingMaster(master) {
      console.info(master);
      this.$router.push({
        path: "/masterDetail",
        query: {
          master: master
        }
      });
    },
    //根据菜品id去找到会做这道菜的师傅列表
    getMasterListByDishId() {
      //菜品id
      const cid = this.dish.id;
      get_master_by_dishId(cid)
        .then(res => {
          this.masterList = res;
          console.info(this.masterList);
        })
        .catch();
    }

    // getMenu() {
    //   // this.$http.post('/healthy/public/api/menu/MenuInfo',{
    //   //   id:this.$route.query.id
    //   // })
    //   // .then(
    //   //   (res)=>{
    //   //     let resData = res.data;
    //   //     if(resData.code == 1){
    //   //       this.$message({
    //   //         message: resData.msg,
    //   //         type: 'success'
    //   //       });
    //   //       this.menu = resData.data;
    //   //     }else{
    //   //       this.$message.error(resData.msg);
    //   //     }
    //   //   }
    //   // ).catch(
    //   //   (err)=>{
    //   //     console.log(err);
    //   //     this.$message.error('网络异常');
    //   //   }
    //   // )
    // }
  }
};
</script>

<style scoped>
ol,
ul {
  list-style: none;
}
a {
  text-decoration: none;
}
p {
  margin: 0;
  padding: 0;
  font-size: 12px;
}
.container {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #f1f1f1;
  overflow: auto;
}
.menuMain {
  margin: 0 auto;
  width: 1200px;
  display: flex;
  box-sizing: border-box;
}
.recipe_header {
  width: 100%;
  background: #efeeec;
}
.recipe_header_c {
  width: 1200px;
  margin: 0px auto;
  padding: 40px 0px;
  font-size: 0px;
}
.recipe_topimgw {
  width: 350px;
  display: inline-block;
  vertical-align: top;
  height: 535px;
  border-radius: 4px;
}
.recipe_topimg {
  /* opacity: 0; */
  width: 350px;
  height: 535px;
}
.recipe_header_info {
  width: 590px;
  display: inline-block;
  vertical-align: top;
  padding-left: 30px;
  box-sizing: border-box;
}
.recipe_header_info .recipe_title {
  font-size: 32px;
  color: #222;
  line-height: 42px;
  font-weight: 700;
  padding-top: 10px;
  margin-right: 40px;
}
.recipe_header_info .info1 {
  font-size: 16px;
  line-height: 26px;
  color: #666;
  font-weight: 400;
}
.recipe_header_info .info1 a {
  color: #666;
}
.recipe_header_info .info2 {
  height: 160px;
  margin: 25px 0px 0px 0px;
  font-size: 0px;
}
.recipe_header_info .info2 .info2_item1 {
  background-position: 0px 0px;
}
.recipe_header_info .info2 .info2_item2 {
  background-position: 0px -160px;
}
.recipe_header_info .info2 .info2_item3 {
  background-position: 0px -320px;
}
.recipe_header_info .info2 .info2_item4 {
  background-position: 0px -480px;
}
.recipe_header_info .info2 .info2_item {
  display: inline-block;
  vertical-align: top;
  height: 160px;
  width: 80px;
  margin-right: 20px;
  border-radius: 16px;
  background: #fff
    url(https://st-cn.meishij.net/p2/20210118/20210118111520_116.png) no-repeat;
  background-size: 80px 640px;
  position: relative;
  position: relative;
  overflow: hidden;
}
.recipe_header_info .info2 .info2_item em {
  font-size: 12px;
  color: #666;
  line-height: 18px;
  position: absolute;
  left: 12px;
  bottom: 37px;
  font-weight: 400;
}
.recipe_header_info .info2 .info2_item strong {
  font-size: 14px;
  color: #222;
  line-height: 20px;
  position: absolute;
  left: 12px;
  bottom: 17px;
  font-weight: 600;
}
.recipe_ingredientsw {
  width: 520px;
  margin: 30px 0px 0px 0px;
}
.recipe_ingredients {
  background: #ffe851;
  border-radius: 16px;
  position: relative;
  margin-bottom: 15px;
}
.recipe_ingredients .left {
  width: 80px;
  position: absolute;
  left: 0px;
  top: 0px;
}
.recipe_ingredients .left strong {
  font-size: 20px;
  text-align: right;
  color: #000;
  font-weight: 600;
  line-height: 22px;
  margin-top: 17px;
  display: block;
  padding-right: 20px;
}
.recipe_ingredients .left em {
  font-size: 12px;
  text-align: right;
  color: #000;
  font-weight: 600;
  line-height: 14px;
  display: block;
  padding-right: 20px;
}
.recipe_ingredients .right {
  background: #fff;
  padding: 18px 20px 8px 20px;
  margin-left: 80px;
  border-top-right-radius: 16px;
  border-bottom-right-radius: 16px;
  position: relative;
  z-index: 100;
}
.recipe_ingredients .right strong {
  font-size: 15px;
  color: #222;
  border-radius: 8px;
  background: #f5f5f5;
  display: inline-block;
  vertical-align: top;
  margin: 0px 12px 12px 0px;
  height: 32px;
  padding: 0px 10px;
  line-height: 32px;
  border-radius: 8px;
}
.recipe_ingredients .right strong a {
  color: #222;
  margin-right: 6px;
}
.recipe_ingredients1 {
  margin-bottom: 0px;
}
.recipe_ingredients {
  background: #ffe851;
  border-radius: 16px;
  position: relative;
  margin-bottom: 15px;
}
.recipe_ingredients .left {
  width: 80px;
  position: absolute;
  left: 0px;
  top: 0px;
}
.recipe_ingredients1 .right {
  background: #fff;
  padding: 18px 20px 8px 20px;
  margin-left: 80px;
}
.recipe_ingredients .left strong {
  font-size: 20px;
  text-align: right;
  color: #000;
  font-weight: 600;
  line-height: 22px;
  margin-top: 17px;
  display: block;
  padding-right: 20px;
}
.recipe_ingredients .left em {
  font-size: 12px;
  text-align: right;
  color: #000;
  font-weight: 600;
  line-height: 14px;
  display: block;
  padding-right: 20px;
}
.recipe_ingredients .right strong {
  font-size: 15px;
  color: #222;
  border-radius: 8px;
  background: #f5f5f5;
  display: inline-block;
  vertical-align: top;
  margin: 0px 12px 12px 0px;
  height: 32px;
  padding: 0px 10px;
  line-height: 32px;
  border-radius: 8px;
}
.recipe_ingredients .right strong a {
  color: #222;
  margin-right: 6px;
}
.menuStep {
  margin: 0 auto;
  width: 1200px;
  box-sizing: border-box;
  background: #fff;
  border-radius: 12px;
}
.menuStepTitle {
  height: 32px;
  padding: 20px 0px 20px 0px;
  font-size: 24px;
  color: #222;
  font-weight: 600;
  margin-top: 20px;
  margin-left: 20px;
  line-height: 32px;
  /* text-align: left; */
}
.recipe_step_box {
  background: #fff;
  border-radius: 12px;
}
.recipe_step {
  position: relative;
  padding: 24px 24px 4px 134px;
  min-height: 128px;
}
.recipe_step .recipe_step_num {
  height: 128px;
  width: 86px;
  position: absolute;
  left: 24px;
  top: 24px;
  background: #ffe851;
  border-radius: 16px;
  border-bottom-right-radius: 2px;
}
.recipe_step .recipe_step_num strong {
  font-size: 20px;
  text-align: right;
  color: #000;
  font-weight: 600;
  line-height: 22px;
  margin-top: 17px;
  display: block;
  padding-right: 20px;
}
.recipe_step .recipe_step_num em {
  font-size: 12px;
  text-align: right;
  color: #000;
  font-weight: 600;
  line-height: 14px;
  display: block;
  padding-right: 20px;
}
.recipe_step .recipe_step_num p {
  font-size: 36px;
  text-align: right;
  color: #000;
  font-weight: 600;
  line-height: 70px;
  display: block;
  padding-right: 20px;
}
.recipe_step .step_content {
  min-height: 128px;
}
.recipe_step .step_content .stepimg {
  border-radius: 4px;
  display: block;
  width: 100%;
  margin-bottom: 15px;
}
.recipe_step .step_content p {
  font-size: 18px;
  color: #222;
  line-height: 28px;
  font-weight: 600;
  padding: 2px 0px 20px 0px;
}
</style>
